import { observable, action, computed, runInAction, autorun, when, reaction } from "mobx"

class SongStore{
    @observable count=10;
    @observable songs=["songs"]
    @observable lyrics="lyrics"
    @observable songlistlist=["songlistlist"]
    constructor(store){
        this.store=store;
    }
    @action.bound getSongInfomationList(value){
        fetch("https://v1.itooi.cn/netease/song?id="+value).then(body=>body.json())
        .then(data=>{
            this.setSongInfomationList(data.data)
            console.log(data.data);
            
        })
    }
    @action.bound setSongInfomationList(list){
        this.songs=list;
    }

    @action.bound getSonglyrics(value){
        fetch("https://v1.itooi.cn/netease/lrc?id="+value).then(response=>response.text())
        .then(data=>{
            console.log(data);
            
            this.setSonglyrics(data)
            // console.log(data.data);
            
        })
    }
    @action.bound setSonglyrics(list){
        this.lyrics=list;
        console.log(this.lyrics);
        
    }
    @action.bound getSonglistlist(value){
        fetch("https://v1.itooi.cn/netease/songList?id="+value).then(response=>response.json())
        .then(data=>{
            console.log(data.data);
            
            this.setSonglistlist(data.data)
            // console.log(data.data);
            
        })
    }
    @action.bound setSonglistlist(list){
        this.songlistlist=list;
        console.log(this.songlistlist);
        
    }
}
export default SongStore